/** @file sys_main.c 
*   @brief Application main file
*   @date 15.Mar.2012
*   @version 03.01.00
*
*   This file contains an empty main function,
*   which can be used for the application.
*/

/* (c) Texas Instruments 2009-2012, All rights reserved. */

/* USER CODE BEGIN (0) */
/* Include FreeRTOS scheduler files */
#include "FreeRTOS.h"
#include "os_task.h"

/* Include HET header file - types, definitions and function declarations for system driver */
#include "het.h"
#include "esm.h"
/* USER CODE END */

/* Include Files */

#include "sys_common.h"
#include "system.h"

/* USER CODE BEGIN (1) */
extern void EMAC_LwIP_Main (uint8_t * emacAddress);

/* Define Task Handles */
xTaskHandle xTask1Handle;
xTaskHandle xTask2Handle;


uint8_t		emacAddress[6] 	= 	{0x00, 0x08, 0xEE, 0x03, 0xA6, 0x6C};
uint32_t 	emacPhyAddress	=	1;


/* USER CODE END */


/** @fn void main(void)
*   @brief Application main function
*   @note This function is empty by default.
*
*   This function is called after startup.
*   The user can use this function to implement the application.
*/

/* USER CODE BEGIN (2) */
/* Task1 */
void vTask1(void *pvParameters)
{
	EMAC_LwIP_Main (emacAddress);
}

/* Task2 */
void vTask2(void *pvParameters)
{
    for(;;)
    {
        /* Taggle HET[1] with timer tick */
        gioSetBit(hetPORT1, 17, gioGetBit(hetPORT1, 17) ^ 1);
        vTaskDelay(100);
    }
}

/* USER CODE END */




uint8_t		emacAddress[6] 	= 	{0x00, 0x08, 0xEE, 0x03, 0xA6, 0x6C};
uint32_t 	emacPhyAddress	=	1;

void main(void)
{
/* USER CODE BEGIN (3) */

    /* Set high end timer GIO port hetPort pin direction to all output */
    gioSetDirection(hetPORT1, 0xFFFFFFFF);


    /* Create Task 1 */
    if (xTaskCreate(vTask1, (const signed char *)"Task1", configMINIMAL_STACK_SIZE, NULL, 1, &xTask1Handle) != pdTRUE)
    {
        /* Task could not be created */
        while(1);
    }

    /* Create Task 2 */
    if (xTaskCreate(vTask2, (const signed char *)"Task2", configMINIMAL_STACK_SIZE, NULL, 2, &xTask2Handle) != pdTRUE)
    {
        /* Task could not be created */
        while(1);
    }
    /* Start Scheduler */
    vTaskStartScheduler();

    /* Run forever */
    while(1);
/* USER CODE END */
}


/* USER CODE BEGIN (4) */
/* USER CODE END */
